﻿#if NET4_0

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.Net.Http
{
    /// <summary>
    /// A base class for exceptions thrown by the System.Net.Http.HttpClient and System.Net.Http.HttpMessageHandler classes.
    /// </summary>
    public class HttpRequestException : Exception
    {

        /// <summary>
        /// Gets the HTTP status code to be returned with the exception.
        /// </summary>
        public HttpStatusCode? StatusCode { get; }

        
        /// <summary>
        /// Initializes a new instance of the System.Net.Http.HttpRequestException class.
        /// </summary>
        public HttpRequestException()
            : base()
        {

        }

        /// <summary>
        /// Initializes a new instance of the System.Net.Http.HttpRequestException class
        /// with a specific message that describes the current exception, an inner exception,
        /// and an HTTP status code.
        /// </summary>
        /// <param name="message">A message that describes the current exception.</param>
        public HttpRequestException(string message)
            : base(message)
        {

        }

        /// <summary>
        /// Initializes a new instance of the System.Net.Http.HttpRequestException class
        /// with a specific message that describes the current exception, an inner exception,
        /// and an HTTP status code.
        /// </summary>
        /// <param name="message">A message that describes the current exception.</param>
        /// <param name="inner">The inner exception.</param>
        public HttpRequestException(string message, Exception inner)
            : base(message, inner)
        {

        }

        /// <summary>
        /// Initializes a new instance of the System.Net.Http.HttpRequestException class
        /// with a specific message that describes the current exception, an inner exception,
        /// and an HTTP status code.
        /// </summary>
        /// <param name="message">A message that describes the current exception.</param>
        /// <param name="inner">The inner exception.</param>
        /// <param name="statusCode">The HTTP status code.</param>
        public HttpRequestException(string message, Exception inner, HttpStatusCode statusCode)
            : base(message, inner)
        {
            this.StatusCode = statusCode;
        }


    }
}
#endif
